package com.yanqu.road.server.cmd.peakstronghold;

import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.PeakStrongholdWarProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.peakstronghold.CrossPeakStrongholdMgr;
import com.yanqu.road.server.protocol.Protocol;

import java.math.BigInteger;

@Cmd(code = Protocol.C_PEAK_STRONGHOLD_ELIMINATION_ATTACK, desc = "发起挑战")
public class CrossPeakStrongholdAttackUnionCmd extends CrossUnionCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        PeakStrongholdWarProto.CrossAttackEliminatePatronsReqMsg req = PeakStrongholdWarProto.CrossAttackEliminatePatronsReqMsg.parseFrom(packet.getBytes());
        CrossPeakStrongholdMgr.attackDefendUnion(req.getActivityId(), req.getUnionId(), req.getTargetUnionId(), serverId, packet.getPlayerId(), req.getPatronsId(),
                new BigInteger(req.getDamage()), PlayerBasePb.parseToUserBaseInfo(req.getUserInfo()));
    }

    @Override
    public void sendData() {

    }
}
